<!-- OrderItem.vue -->
<template>
  <div class="order_item">
    <div class="head">
      <span>下单时间：2022-10-31 08:25:49</span>
      <span>订单编号：1586877060686860289</span>
      <strong>删除</strong>
    </div>
    <div class="body">
      <div class="column goods">
        <ul>
          <li v-for="item in liList" :key="item.id">
            <div class="img">
              <el-image :src="item.image" lazy></el-image>
              <!-- <img :src="item.image" alt=""> -->
            </div>
            <div class="info">
              <p class="name ellipsis-2">{{item.name}}</p>
              <p class="attr ellipsis">{{item.attrsText}}</p>
            </div>
            <div class="price">¥{{item.curPrice}}</div>
            <div class="count">x{{item.quantity}}</div>
          </li>
        </ul>
      </div>
      <div class="column state">
        <p>已取消</p>
      </div>
      <div class="column amount">
        <p class="red">¥333</p>
        <p>（含运费：¥7）</p>
        <p>在线支付</p>
      </div>
      <div class="column action">
        <slot name="a"></slot>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "OrderItem",
  props: ["orderList"],
  data() {
    return {
      liList: []
    }
  },
  created() {
    // console.log(this.orderList);
    this.liList = this.orderList.skus;
  }
}
</script>
<style lang='scss' scoped>
.order_item {
  margin-bottom: 20px;
  border: 1px solid #f5f5f5;
  box-sizing: border-box;
  .head {
    height: 50px;
    line-height: 50px;
    background: #f5f5f5;
    padding: 0 20px;
    overflow: hidden;
    font-size: 14px;
    span {
      margin-right: 20px;
      box-sizing: border-box;
      color: #333;
    }
    strong {
      margin-right: 0;
      float: right;
      color: #999;
      font-weight: 400;
    }
  }
  .body {
    display: flex;
    align-items: stretch;
    box-sizing: border-box;
    .column {
      border-left: 1px solid #f5f5f5;
      text-align: center;
      padding: 20px;
      >p {
        padding-top: 10px;
        font-size: 14px;
      }
    }
    .column:first-child {
      border-left: none;
    }
    .goods {
      width: 500px;
      padding: 0;
      align-self: center;
      box-sizing: border-box;
      ul {
        box-sizing: border-box;
        li {
          border-bottom: 1px solid #f5f5f5;
          padding: 10px;
          display: flex;
          .img {
            display: inline-block;
            width: 70px;
            height: 70px;
            border: 1px solid #f5f5f5;
            color: #333;
            img {
              max-width: 100%;
              max-height: 100%;
              vertical-align: middle;
            }
          }
          .info {
            width: 220px;
            text-align: left;
            padding: 0 10px;
            box-sizing: border-box;
            p {
              margin-bottom: 5px;
            }
            .name {
              height: 38px;
              font-size: 14px;
              line-height: 19px;
            }
            .ellipsis-2 {
              word-break: break-all;
              display: -webkit-box;
              -webkit-box-orient: vertical;
              -webkit-line-clamp: 2;
            }
            .ellipsis, .ellipsis-2 {
              text-overflow: ellipsis;
              overflow: hidden;
            }
            .ellipsis {
              white-space: nowrap;
            }
            .attr {
              color: #999;
              font-size: 12px;
            }
          }
          .price {
            width: 100px;
            box-sizing: border-box;
          }
          .count {
            width: 80px;
            box-sizing: border-box;
          }
        }
        li:last-child {
          border-bottom: none;
        }
      }
    }
    .state {
      width: 120px;
    }
    .amount {
      width: 200px;
      box-sizing: border-box;
      .red {
        color: #cf4444;
      }
    }
    .active {
      width: 140px;
    }
  }
}
</style>